package com.music.server.controller;

import com.music.server.service.OssService;
import com.music.server.utils.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("oss")
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("upload")
    public ResultVo upload(@RequestParam("file") MultipartFile file){
        String url =   ossService.upload(file);
        return ResultVo.ok().data("url",url);
    }

}
